<?php

namespace App\Modules\System\Models;


use Illuminate\Database\Eloquent\Model;

/**
 * Class Dictionary 用餐时间段
 * @package App\Modules\Task\Models
 */
class Dictionary extends Model
{
    protected $table = 'dictionary';

    protected $fillable = ['id','dictionary_id', 'key', 'value', 'remark', 'created_at', 'updated_at', 'status'];

    /**
     * 用餐字典列表
     */
    static function getList($dictionary_id)
    {
        return self::select(['id','key','value'])->where('dictionary_id',$dictionary_id)->where('status',1)->get()->toArray();
    }

    /**
     * 获取字典
     * @param $id 任务id
     * @return mixed
     */
    static function getDictionary($key)
    {
        return self::where('key',$key)->where('status',1)->first();
    }
}